package com.diamond.web.dto;


import java.util.ArrayList;
import java.util.List;

import com.diamond.web.model.system.Permission;

public class MenuDto extends Permission{
	private List<MenuDto> children;

	private String menuUrl;
	
	public MenuDto(Permission p,String urlPattern) {
		this.setId(p.getId());
		this.setIsMenu(p.getIsMenu());
		this.setMenuIcon(p.getMenuIcon());
		this.setPermissionName(p.getPermissionName());
		this.setPermissionSign(p.getPermissionSign());
		this.setSort(p.getSort());
		this.menuUrl= urlPattern+this.getPermissionSign();
	}
	
	public List<MenuDto> getChildren() {
		return children;
	}

	public void setChildren(List<MenuDto> children) {
		this.children = children;
	}
	
	public void addChlidren(MenuDto child){
		if(this.children==null){
			this.children=new ArrayList<MenuDto>();
		}
		this.children.add(child);
	}

	public String getMenuUrl() {
		return menuUrl;
	}

	public void setMenuUrl(String menuUrl) {
		this.menuUrl = menuUrl;
	}
}
